package com.paic.mhis.hcpms.quota.settlement.biz.service.impl;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.paic.mhis.core.user.biz.service.RegionContext;
import com.paic.mhis.core.user.dto.RegionDTO;
import com.paic.mhis.hcpms.quota.calculationreport.kpiinterface.biz.service.KpiCoreDataService;
import com.paic.mhis.hcpms.quota.calculationreport.kpiinterface.dto.KpiConditionDTO;
import com.paic.mhis.hcpms.quota.calculationreport.kpiinterface.dto.KpiGradeDTO;
import com.paic.mhis.hcpms.quota.calculationreport.kpiinterface.dto.KpiSociationDTO;
import com.paic.mhis.hcpms.quota.settlement.biz.service.AnalyseService;
import com.paic.mhis.hcpms.quota.settlement.biz.service.KpiRegionCodeService;
import com.paic.mhis.hcpms.quota.settlement.common.Constants;
import com.paic.mhis.hcpms.quota.settlement.common.KpiValueConst;
import com.paic.mhis.hcpms.quota.settlement.dao.KpiBaseDAO;
import com.paic.mhis.hcpms.quota.settlement.dto.KpiBaseDTO;
import com.paic.mhis.hcpms.quota.settlement.dto.MedicalOrgDTO;

@Service("analyseService")
public class AnalyseServiceImpl implements AnalyseService {
	@Autowired
	private KpiBaseDAO kpiBaseDao;

	@Autowired
	private KpiCoreDataService kpiCoreDataService;
	@Autowired
	private KpiRegionCodeService kpiRegionCodeService;

	/**
	 * 指标分析
	 * 
	 * @param visitType
	 *            就诊类型
	 * @param month
	 *            月份
	 * @param userId
	 *            当前用户
	 * @return
	 */
	@Override
	public Map<String, Object> analyseFindLevel(String month, String userId) {
		Map<String, Object> mapOneLevel = new HashMap<String, Object>();

		KpiConditionDTO condition = new KpiConditionDTO();
		String fee[] = { "fee", "budget", "percentage", "distribution" };// fee：医疗费用，budget：医疗费用预拨，percentage：医疗费用占比，distribution：费用分布
		String feeVal[] = { "KPI0001", "KPI0003", "KPI0002" };
		condition.setKpiTime(month);
		String regionCode = kpiRegionCodeService.getRegionCode(userId);
		if(StringUtils.isEmpty(regionCode)){
			mapOneLevel = new HashMap<String, Object>();
			mapOneLevel.put("state", "1");
			mapOneLevel.put("msg","当前用户没有指定统筹区域,请联系管理员,指定所在统筹区域!!!");
            return mapOneLevel;
        }
		condition.setSociationCode(regionCode);
		boolean isFlag = true;// true:费用分布,false:医疗费用,医疗费用预拨,医疗费用占比
		for (int k = 0; k < fee.length; k++) {
			if (k != 3) {
				isFlag = feeVal[k].equals("KPI0002") ? false : true;
				condition.setKpiCode(feeVal[k]);
				mapOneLevel.put(fee[k], getKipMap(condition, isFlag));
			} else {// 费用分布
				Map<String, Object> mapTwoLevel = this.getKipDistribution(condition);
				if (null != mapTwoLevel) {
					mapOneLevel.put(fee[k], mapTwoLevel);
				}
			}
		}
		mapOneLevel.put("state", "0");
		return mapOneLevel;
	}

	// 医疗机构等级：1.一级医院，2.二级医院，3.三级医院
	private Map<String, Object> getKipMap(KpiConditionDTO condition, boolean isFlag) {
		Map<String, Object> map = new HashMap<String, Object>();
		List<KpiGradeDTO> kpiGrades = kpiCoreDataService.queryKpiByGrade(condition);

		// 存储一级的集合
		List<KpiGradeDTO> grade4 = new ArrayList<KpiGradeDTO>();

		// 存储二级的集合
		List<KpiGradeDTO> grade3 = new ArrayList<KpiGradeDTO>();

		// 存储三级的集合
		List<KpiGradeDTO> grade2 = new ArrayList<KpiGradeDTO>();

		for (KpiGradeDTO dto : kpiGrades) {
			if (Constants.type_4.equals(dto.getGrade())) {
				grade4.add(dto);
			} else if (Constants.type_3.equals(dto.getGrade())) {
				grade3.add(dto);
			} else if (Constants.type_2.equals(dto.getGrade())) {
				grade2.add(dto);
			}
		}
		// 存储指标类型总 指标医院级别
		double allNum = 0.00; // 合计 总
		double hospNum = 0.00; // 合计 住
		double outNum = 0.00; // 合计 门

		double allNum4 = 0.00; // 一级 总
		double hospNum4 = 0.00; // 一级 住
		double outNum4 = 0.00; // 一级 门
		for (KpiGradeDTO dto : grade4) {
			if (Constants.visitType_all_value.equals(dto.getVisitType())) {
				allNum4 = allNum4 + Double.parseDouble(dto.getKpiValue().toString());
				allNum = allNum + Double.parseDouble(dto.getKpiValue().toString());
			} else if (Constants.visitType_hosp_value.equals(dto.getVisitType())) {
				hospNum4 = hospNum4 + Double.parseDouble(dto.getKpiValue().toString());
				hospNum = hospNum + Double.parseDouble(dto.getKpiValue().toString());
			} else if (Constants.visitType_out_value.equals(dto.getVisitType())) {
				outNum4 = outNum4 + Double.parseDouble(dto.getKpiValue().toString());
				outNum = outNum + Double.parseDouble(dto.getKpiValue().toString());
			}
		}

		double allNum3 = 0.00; // 二级 总
		double hospNum3 = 0.00; // 二级 住
		double outNum3 = 0.00; // 二级 门
		for (KpiGradeDTO dto : grade3) {
			if (Constants.visitType_all_value.equals(dto.getVisitType())) {
				allNum3 = allNum3 + Double.parseDouble(dto.getKpiValue().toString());
				allNum = allNum + Double.parseDouble(dto.getKpiValue().toString());
			} else if (Constants.visitType_hosp_value.equals(dto.getVisitType())) {
				hospNum3 = hospNum3 + Double.parseDouble(dto.getKpiValue().toString());
				hospNum = hospNum + Double.parseDouble(dto.getKpiValue().toString());
			} else if (Constants.visitType_out_value.equals(dto.getVisitType())) {
				outNum3 = outNum3 + Double.parseDouble(dto.getKpiValue().toString());
				outNum = outNum + Double.parseDouble(dto.getKpiValue().toString());
			}
		}

		double allNum2 = 0.00; // 三级 总
		double hospNum2 = 0.00; // 三级 住
		double outNum2 = 0.00; // 三级 门
		for (KpiGradeDTO dto : grade2) {
			if (Constants.visitType_all_value.equals(dto.getVisitType())) {
				allNum2 = allNum2 + Double.parseDouble(dto.getKpiValue().toString());
				allNum = allNum + Double.parseDouble(dto.getKpiValue().toString());
			} else if (Constants.visitType_hosp_value.equals(dto.getVisitType())) {
				hospNum2 = hospNum2 + Double.parseDouble(dto.getKpiValue().toString());
				hospNum = hospNum + Double.parseDouble(dto.getKpiValue().toString());
			} else if (Constants.visitType_out_value.equals(dto.getVisitType())) {
				outNum2 = outNum2 + Double.parseDouble(dto.getKpiValue().toString());
				outNum = outNum + Double.parseDouble(dto.getKpiValue().toString());
			}
		}
		map.put(Constants.visitType_all, assignmentMap(allNum4, allNum3, allNum2, isFlag));
		map.put(Constants.visitType_hosp, assignmentMap(hospNum4, hospNum3, hospNum2, isFlag));
		map.put(Constants.visitType_out, assignmentMap(outNum4, outNum3, outNum2, isFlag));
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		Map<String, Object> table1 = getTableMap(allNum4, hospNum4, outNum4);
		table1.put("orgLevel", Constants.org_Level_4);
		Map<String, Object> table2 = getTableMap(allNum3, hospNum3, outNum3);
		table2.put("orgLevel", Constants.org_Level_3);
		Map<String, Object> table3 = getTableMap(allNum2, hospNum2, outNum2);
		table3.put("orgLevel", Constants.org_Level_2);
		list.add(table3);
		list.add(table2);
		list.add(table1);
		if (isFlag) {
			Map<String, Object> table = getTableMap(allNum, hospNum, outNum);
			table.put("orgLevel", "合计");
			list.add(table);
		}
		map.put("table", list);
		return map;
	}

	// echats 数据
	private Map<String, Object> assignmentMap(double l1, double l2, double l3, boolean isFlag) {
		Map<String, Object> map = new HashMap<String, Object>();
		if (isFlag) {
			map.put(Constants.l1,
					new BigDecimal(l1).divide(new BigDecimal("10000")).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
			map.put(Constants.l2,
					new BigDecimal(l2).divide(new BigDecimal("10000")).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
			map.put(Constants.l3,
					new BigDecimal(l3).divide(new BigDecimal("10000")).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
		} else {
			map.put(Constants.l1, new BigDecimal(l1).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
			map.put(Constants.l2, new BigDecimal(l2).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
			map.put(Constants.l3, new BigDecimal(l3).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
		}

		return map;
	}

	// table 数据
	private Map<String, Object> getTableMap(double all, double hosp, double out) {
		Map<String, Object> map = new HashMap<String, Object>();
		BigDecimal allNum = new BigDecimal(all).setScale(2, BigDecimal.ROUND_HALF_UP);
		BigDecimal hospNum = new BigDecimal(hosp).setScale(2, BigDecimal.ROUND_HALF_UP);
		BigDecimal outNum = new BigDecimal(out).setScale(2, BigDecimal.ROUND_HALF_UP);

		map.put(Constants.visitType_all, String.valueOf(allNum));
		map.put(Constants.visitType_hosp, String.valueOf(hospNum));
		map.put(Constants.visitType_out, String.valueOf(outNum));
		return map;
	}

	// 费用分布
	private Map<String, Object> getKipDistribution(KpiConditionDTO condition) {
		Map<String, Object> map = new HashMap<String, Object>();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		// 存储一级 集合
		List<Map<String, Object>> listOne = new ArrayList<Map<String, Object>>();
		// 存储二级 集合
		List<Map<String, Object>> listTwo = new ArrayList<Map<String, Object>>();
		// 存储 三级 集合
		List<Map<String, Object>> listThree = new ArrayList<Map<String, Object>>();

		// 存储 总 集合
		List<Map<String, Object>> listALL = new ArrayList<Map<String, Object>>();
		// 存储 住 集合
		List<Map<String, Object>> listHosp = new ArrayList<Map<String, Object>>();
		// 存储 门 集合
		List<Map<String, Object>> listOut = new ArrayList<Map<String, Object>>();
		for (int i = 0; i < Constants.kips.length; i++) {
			condition.setKpiCode(Constants.kips[i]);
			Map<String, Object> kpiMap = getKipMap(condition, false);

			Map<String, Object> allMap = new HashMap<String, Object>();
			allMap.put(Constants.kips[i], kpiMap.get(Constants.visitType_all));
			listALL.add(allMap);

			Map<String, Object> hospMap = new HashMap<String, Object>();
			hospMap.put(Constants.kips[i], kpiMap.get(Constants.visitType_hosp));
			listHosp.add(hospMap);

			Map<String, Object> outMap = new HashMap<String, Object>();
			outMap.put(Constants.kips[i], kpiMap.get(Constants.visitType_out));
			listOut.add(outMap);
			// 获取不同等级的集合
			List<Map<String, Object>> tableMap = (List<Map<String, Object>>) kpiMap.get("table");
			for (Map<String, Object> strMap : tableMap) {
				if (Constants.org_Level_4.equals(strMap.get("orgLevel"))) {
					strMap.put("kpiCode", Constants.kips[i]);
					listOne.add(strMap);
				} else if (Constants.org_Level_3.equals(strMap.get("orgLevel"))) {
					strMap.put("kpiCode", Constants.kips[i]);
					listTwo.add(strMap);
				} else if (Constants.org_Level_2.equals(strMap.get("orgLevel"))) {
					strMap.put("kpiCode", Constants.kips[i]);
					listThree.add(strMap);
				}
			}

		}
		listALL.add(getOtherMap(listALL));
		listHosp.add(getOtherMap(listHosp));
		listOut.add(getOtherMap(listOut));

		listOne.add(getOtherLevelMap(listOne));
		listTwo.add(getOtherLevelMap(listTwo));
		listThree.add(getOtherLevelMap(listThree));
		map.put(Constants.visitType_all, listALL);
		map.put(Constants.visitType_hosp, listHosp);
		map.put(Constants.visitType_out, listOut);

		Map<String, Object> three = new HashMap<String, Object>();
		three.put("list", listThree);
		three.put("orgLevel", Constants.org_Level_2);
		list.add(three);
		Map<String, Object> two = new HashMap<String, Object>();
		two.put("list", listTwo);
		two.put("orgLevel", Constants.org_Level_3);
		list.add(two);

		Map<String, Object> one = new HashMap<String, Object>();
		one.put("list", listOne);
		one.put("orgLevel", Constants.org_Level_4);
		list.add(one);
		map.put("table", list);

		return map;
	}

	// 获取费用分布 echats其他
	private Map<String, Object> getOtherMap(List<Map<String, Object>> list) {
		Map<String, Object> other = new HashMap<String, Object>();
		Map<String, Object> map = new HashMap<String, Object>();

		double l1 = 100.00, l2 = 100.00, l3 = 100.00;
		for (Map<String, Object> otherMap : list) {
			Map<String, Object> resMap = null;
			for (String kip : Constants.kips) {
				if (null == resMap) {
					resMap = (Map<String, Object>) otherMap.get(kip);
				}
			}

			l1 = l1 - Double.parseDouble(resMap.get(Constants.l1).toString());
			l2 = l2 - Double.parseDouble(resMap.get(Constants.l2).toString());
			l3 = l3 - Double.parseDouble(resMap.get(Constants.l3).toString());
		}
		if (l1 == 100.00) {
			l1 = 0.00;
		}
		if (l2 == 100.00) {
			l2 = 0.00;
		}
		if (l3 == 100.00) {
			l3 = 0.00;
		}
		map.put(Constants.l1, new BigDecimal(l1).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
		map.put(Constants.l2, new BigDecimal(l2).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
		map.put(Constants.l3, new BigDecimal(l3).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
		other.put("other", map);
		return other;
	}

	// 获取table
	private Map<String, Object> getOtherLevelMap(List<Map<String, Object>> list) {
		Map<String, Object> other = new HashMap<String, Object>();
		double all = 100.00, hosp = 100.00, out = 100.00;
		for (Map<String, Object> otherMap : list) {
			all = all - Double.parseDouble(otherMap.get(Constants.visitType_all).toString());
			hosp = hosp - Double.parseDouble(otherMap.get(Constants.visitType_hosp).toString());
			out = out - Double.parseDouble(otherMap.get(Constants.visitType_out).toString());
		}
		if (all == 100.00) {
			all = 0.00;
		}
		if (hosp == 100.00) {
			hosp = 0.00;
		}
		if (out == 100.00) {
			out = 0.00;
		}
		other.put(Constants.visitType_all, new BigDecimal(all).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
		other.put(Constants.visitType_hosp, new BigDecimal(hosp).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
		other.put(Constants.visitType_out, new BigDecimal(out).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
		other.put("kpiCode", "other");
		return other;
	}

	@Override
	public List<KpiBaseDTO> queryKpiBaseAll(String kpiType) {
		Map<String, Object> map = new HashMap<String, Object>();
		RegionContext rc = RegionContext.get();
		List<RegionDTO> regionDtos = rc.getRegions();
		map.put("regionCodes", regionDtos);
		map.put("kpiType", kpiType);
		return kpiBaseDao.queryKpiBaseAll(map);
	}

	@Override
	public List<MedicalOrgDTO> queryMedicalOrgAll(String orgLevel) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("orgLevel", orgLevel);
		return kpiBaseDao.queryMedicalOrgAll(map);
	}

	@Override
	public Map<String, Object> findAllVisitTypeKipData(String year, String month, String kpiCode, String regionCode) {
		// 在查询时候，或者再处理之前，将就诊类型(0:总 1:住院 2:门诊)替换成（all,hosp,out）
		List<KpiGradeDTO> kpiList = testCreateKpiBaseData(kpiCode);// 修改为从数据库中获取，要求按照医院等级进行排序
		Map<String, Object> outTargetmap = new HashMap<String, Object>();// 目标格式
		if (kpiList == null || kpiList.size() == 0) {
			return outTargetmap;
		}
		// 1、将原始list按照就诊类型进行归类，组织就诊类型数据格式
		Map<String, List<KpiGradeDTO>> outOldMap = new HashMap<String, List<KpiGradeDTO>>();// 原始格式
		for (KpiGradeDTO dto : kpiList) {
			if (dto.getVisitType() == null)
				continue;
			List<KpiGradeDTO> list = outOldMap.get(dto.getVisitType());
			if (list == null) {
				list = new ArrayList<KpiGradeDTO>();
				list.add(dto);
				outOldMap.put(dto.getVisitType(), list);
			} else {
				list.add(dto);
			}
		}
		for (Entry<String, List<KpiGradeDTO>> entry : outOldMap.entrySet()) {
			Map<String, Object> innerMap = new HashMap<String, Object>();
			List<KpiGradeDTO> lvList = entry.getValue();
			for (KpiGradeDTO dto : lvList) {
				if (dto.getGrade() != null) {
					innerMap.put(dto.getGrade(), dto.getKpiValue().toString());
				}
			}
			outTargetmap.put(entry.getKey(), innerMap);
		}
		// 2、将原始list按照等级进行划分，组织表格数据
		Map<String, List<KpiGradeDTO>> tblMap = new HashMap<String, List<KpiGradeDTO>>();
		List<Map<String, Object>> tblTargetList = new ArrayList<Map<String, Object>>();
		for (KpiGradeDTO dto : kpiList) {
			if (dto.getGrade() == null)
				continue;
			List<KpiGradeDTO> list = tblMap.get(dto.getGrade());
			if (list == null) {
				list = new ArrayList<KpiGradeDTO>();
				list.add(dto);
				tblMap.put(dto.getGrade(), list);
			} else {
				list.add(dto);
			}
		}
		for (Entry<String, List<KpiGradeDTO>> entry : tblMap.entrySet()) {
			Map<String, Object> innerMap = new HashMap<String, Object>();
			// level : entry.getKey()
			innerMap.put("orgLevel", entry.getKey());
			List<KpiGradeDTO> list = entry.getValue();
			for (KpiGradeDTO dto : list) {
				innerMap.put(dto.getVisitType(), dto.getKpiValue().toString());
			}
			tblTargetList.add(innerMap);
		}
		outTargetmap.put("table", tblTargetList);
		return outTargetmap;
	}

	private List<KpiGradeDTO> testCreateKpiBaseData(String kpiCode) {
		String kpiName = "";
		if ("fee".equals(kpiCode)) {
			kpiName = "医疗费用";
		} else if ("budget".equals(kpiCode)) {
			kpiName = "医疗费用预拨";
		} else if ("percentage".equals(kpiCode)) {
			kpiName = "医疗费用占比";
		} else if ("distribution".equals(kpiCode)) {
			kpiName = "费用分布";
		}
		List<KpiGradeDTO> kpiList = new ArrayList<KpiGradeDTO>();
		return kpiList;
	}

	@Override
	public Map<String, Object> getFeeInfos(String month, String userId) {
		Map<String, Object> resultMap = null;
		KpiConditionDTO c = new KpiConditionDTO();
		String regionCode = kpiRegionCodeService.getRegionCode(userId);
        if(StringUtils.isEmpty(regionCode)){
        	resultMap = new HashMap<String, Object>();
        	resultMap.put("state", "1");
        	resultMap.put("msg","当前用户没有指定统筹区域,请联系管理员,指定所在统筹区域!!!");
            return resultMap;
        }
		c.setSociationCode(regionCode);
		c.setKpiTime(month);
		List<String> vl = new ArrayList<String>();
		vl.add(KpiValueConst.VISIT_ALL);
		vl.add(KpiValueConst.VISIT_HOS);
		vl.add(KpiValueConst.VISIT_OUT);
		c.setVisitTypeList(vl);
		List<String> kl = new ArrayList<String>();
		kl.add(KpiValueConst.KPI0001);
		kl.add(KpiValueConst.KPI0010);
		c.setKpiCodeList(kl);
		List<KpiSociationDTO> list = kpiCoreDataService.queryKpiBySoc(c);
		resultMap = conventListToMap(list);
		resultMap.put("state", "0");
		return resultMap;
	}

	private Map<String, Object> conventListToMap(List<KpiSociationDTO> list) {
		Map<String, Object> result = new HashMap<String, Object>();
		Map<String, Object> feeInfoMap = new HashMap<String, Object>();
		Map<String, Object> feeDistributionMap = new HashMap<String, Object>();
		Map<String, Object> visitorsDistributionMap = new HashMap<String, Object>();
		for (KpiSociationDTO ksd : list) {
			if (KpiValueConst.KPI0001.equals(ksd.getKpiCode())) {
				if (KpiValueConst.VISIT_ALL.equals(ksd.getVisitType())) {
					feeInfoMap.put("feeTotal",
							ksd.getKpiValue().divide(new BigDecimal("10000")).setScale(2, BigDecimal.ROUND_HALF_UP)
									.toString());
					feeInfoMap.put("yoy", ksd.getPeriodRatio() == null ? "0.00" : ksd.getPeriodRatio().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
					feeInfoMap.put("mom", ksd.getChainRatio() == null ? "0.00" : ksd.getChainRatio().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
				} else if (KpiValueConst.VISIT_HOS.equals(ksd.getVisitType())) {
					feeDistributionMap.put("hosp", ksd.getKpiValue() == null ? "0.00" : ksd.getKpiValue().toString());
				} else if (KpiValueConst.VISIT_OUT.equals(ksd.getVisitType())){
					feeDistributionMap.put("out", ksd.getKpiValue() == null ? "0.00" : ksd.getKpiValue().toString());
				}
			}
			if (KpiValueConst.KPI0010.equals(ksd.getKpiCode())) {
				if (KpiValueConst.VISIT_HOS.equals(ksd.getVisitType())) {
					visitorsDistributionMap.put("hosp",
							ksd.getKpiValue().divide(new BigDecimal("10000")).setScale(2, BigDecimal.ROUND_HALF_UP)
									.toString());
				} else if (KpiValueConst.VISIT_OUT.equals(ksd.getVisitType())) {
					visitorsDistributionMap.put("out",
							ksd.getKpiValue().divide(new BigDecimal("10000")).setScale(2, BigDecimal.ROUND_HALF_UP)
									.toString());
				}
			}
		}
		result.put("feeInfo", feeInfoMap);

		String hosp = feeDistributionMap.get("hosp") == null ? "0.00" : feeDistributionMap.get("hosp").toString();
		hosp = new BigDecimal(hosp).divide(new BigDecimal("10000")).setScale(2, BigDecimal.ROUND_HALF_UP).toString();
		String out = feeDistributionMap.get("out") == null ? "0.00" : feeDistributionMap.get("out").toString();
		out = new BigDecimal(out).divide(new BigDecimal("10000")).setScale(2, BigDecimal.ROUND_HALF_UP).toString();
		feeDistributionMap.put("hosp", hosp);
		feeDistributionMap.put("out", out);
		result.put("feeDistribution", feeDistributionMap);
		result.put("visitorsDistribution", visitorsDistributionMap);
		return result;
	}

}
